package com.lanchetech.user.service.impl;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.util.PageHelpUtil;
import com.lanchetech.common.enums.ToggleEnum;
import com.lanchetech.dao.JobMapper;
import com.lanchetech.entity.Job;
import com.lanchetech.user.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JobServiceImpl implements JobService {


    @Autowired
    JobMapper jobMapper;

    @Override
    public ResultData<BasePageResp<Job>> getJobPage(PageReq req) {
        Page page = PageHelper.startPage(req.getPageNo(),req.getPageSize());
        req.setStatus(ToggleEnum.ON.getStatus());
        List<Job> list = jobMapper.findAllPage(req);
        return PageHelpUtil.buildPage(list,page);
    }
}
